package com.tonghe.dao;

import com.tonghe.pojo.User;
import com.tonghe.utils.MybatisUtils;
import org.apache.ibatis.session.SqlSession;
import org.testng.annotations.Test;

import java.util.List;

/**
 * @Date:2021/12/18- 12- 18- 13:25
 **/
public class UserDao {
    @Test
    public void testGetLi2st(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();

        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        List<User> rs = mapper.getUserList();
        for (User user:rs
             ) {
            System.out.println(user.toString());
        }
        sqlSession.close();
    }
    @Test
    public void testGetList(){
        SqlSession sqlSession = MybatisUtils.getSqlSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        List<User> userList = userMapper.getUserList();
        for (User user:
                userList) {
            System.out.println(user);
        }
    }
}
